<template>
    <rx-layout>
        <div slot="center" style>
            <rx-fit>
                <div slot="toolheader" foldheader="true" foldbtn="false" border="false">
                    <div class="table-operator">
                        <a-button type="primary" icon="plus" @click="add">{{$ti18('rxList.newBtn','新建')}}</a-button>
                    </div>
                    <span class="search-btn-box">
                        <span class="search-btn" @click="searchshow"><i class="iconfont iconguolv"></i>{{$ti18('rxList.leachBtn','过滤')}}</span>
                    </span>
                </div>
                <div slot="searchbar" btnalign="right" v-if="fitSearch" @search="search" @cancel="cancel"
                     @close="close">
                    <a-form layout="vertical">
                        <a-form-item :label="i18n('form.tranAccount','移交人账号')">
                            <a-input :placeholder="i18n('form.tranAccount','移交人账号','input')" v-model="queryParam.Q_DELIVER_USER_NO__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.transferee','移交人')">
                            <a-input :placeholder="i18n('form.transferee','移交人','input')" v-model="queryParam.Q_DELIVER_USER_NAME__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.receAccout','接管人账号')">
                            <a-input :placeholder="i18n('form.receAccout','接管人账号','input')" v-model="queryParam.Q_RECEIPT_USER_NO__S_LK"/>
                        </a-form-item>
                        <a-form-item :label="i18n('form.receiver','接管人')">
                            <a-input :placeholder="i18n('form.receiver','接管人','input')" v-model="queryParam.Q_RECEIPT_USER_NAME__S_LK"/>
                        </a-form-item>
                    </a-form>
                </div>
                <rx-grid
                    class="rxGrids"
                    ref="table"
                    :bordered="isBorder"
                    :multiSelect="true"
                    :columns="columns"
                    :defaultPageSize="10"
                    url="/api-bpm/bpm/core/bpmDeliver/query"
                    :queryParam="queryParam"
                    data-field="result.data"
                    :pageSizeOptions="['10','30','40']"
                    id-field="id"
                    @selectChange="onSelectChange"
                    :hand-row-class="customRowBg"
                    :getCheckboxProps="getCheckboxProps"
                >
        <span slot="deliverUserName" slot-scope="{text, record}" class="actionIcons">
            {{ record.deliverUserName }}({{ record.deliverUserNo }})
        </span>
                    <span slot="receiptUserName" slot-scope="{text, record}" class="actionIcons">
            {{ record.receiptUserName }}({{ record.receiptUserNo }})
        </span>
                    <span slot="action" slot-scope="{text, record}" class="actionIcons">
          <span v-if="removeEnable" @click="delByIds([record.id])">{{$ti18('rxList.delBtn','删除')}}</span>
        </span>
                </rx-grid>
            </rx-fit>
        </div>
    </rx-layout>
</template>

<script>
import BpmDeliverApi from '@/api/bpm/core/bpmDeliver'
import BpmDeliverEdit from './BpmDeliverEdit'
import {BaseList, RxFit, RxGrid} from '@lowcode/jpaas-common-lib';

export default {
    name: 'BpmDeliverList',
    mixins: [BaseList],
    components: {
        RxFit
    },
    data() {
        return {
            columns: [
                {
                    title: this.$ti18('rxList.index','序号'),
                    type: 'indexColumn',
                    width: 40,
                    dataIndex: 'serial',
                    scopedSlots: {customRender: 'serial'}
                },
                {
                    title: this.i18n('form.transferee','移交人'),
                    dataIndex: 'deliverUserName',
                    width: 150,
                    scopedSlots: {customRender: 'deliverUserName'}
                },
                {
                    title: this.i18n('form.receiver','接管人'),
                    dataIndex: 'receiptUserName',
                    width: 150,
                    scopedSlots: {customRender: 'receiptUserName'}
                },
                {title: this.$ti18('rxForm.notes','备注'), dataIndex: 'comment', width: 200},
                {title: this.i18n('form.addTime','添加移交时间'), dataIndex: 'createTime', width: 150},
                {title: this.$ti18('rxList.action','操作'), width: 40, dataIndex: 'action', scopedSlots: {customRender: 'action'}}
            ],
            component: BpmDeliverEdit,
            comment: this.i18n('list.workHand','工作交接'),
            widthHeight: ['600px', '400px'],
            fitSearch: false,
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"bpmDeliver",key);
        },
        delById(ids) {
            return BpmDeliverApi.del({ids: ids.join(',')});
        },
        getListByParams(parameter) {
            return BpmDeliverApi.query(parameter)
        },
        customRowBg(record) {//表格行类名
            if (record.isHistory == '1') {
                return 'rowHidden'
            }
        },
        getCheckboxProps(record) {//表格选择框不能选中
            let obj = {};
            if (record.isHistory == '1') {
                obj = {
                    disabled: true
                }
            }
            return {
                props: obj
            }
        }


    }
}
</script>
<style scoped>

.rxGrids >>> .rowHidden,
.rxGrids >>> .rowHidden td {
    background-color: rgba(0, 0, 0, 0.05) !important;
}
</style>

